change column values based on another column pandas

31

df['New Column'] = np.where(df['A']==0, df['B'], df['A'])
import pandas
df = pandas.read_csv("test.csv")
df.loc[df.ID == 103, 'FirstName'] = "Matt"
df.loc[df.ID == 103, 'LastName'] = "Jones"

Comments

Submit
0 Comments